<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMploginsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('mplogins', function (Blueprint $table) {
            $table->id();
            $table->string('platform', 10)->default('wx')->comment('平台');
            $table->string('openid')->comment('openid');
            $table->unsignedBigInteger('user_id')->comment('关联用户');
            $table->timestamps();

            $table->unique(['openid', 'platform']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mplogins');
    }
}
